package com.fcy.teamwork.pojo;

import java.io.Serializable;
import java.text.SimpleDateFormat;

public class ProjectNode implements Serializable {
    public ProjectNode() {
    }

    public ProjectNode(Integer id, String projectId, String owners, Long beginTmp, Long enTmp, Integer state, Integer step, String title) {
        this.id = id;
        this.projectId = projectId;
        this.owners = owners;
        this.beginTmp = beginTmp;
        this.enTmp = enTmp;
        this.state = state;
        this.step = step;
        this.title = title;
    }

    /**
     *
     */
    private Integer id;

    /**
     * 关联项目id
     */
    private String projectId;

    /**
     * 负责人ids:"123,234"
     */
    private String owners;

    /**
     *
     */
    private Long beginTmp;

    /**
     *
     */
    private Long enTmp;

    /**
     * 是否已完成 1：true 0：false
     */
    private Integer state;

    /**
     * 第几步骤 从1开始
     */
    private Integer step;
    private String title;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    private static final long serialVersionUID = 1L;

    /**
     *
     */
    public Integer getId() {
        return id;
    }

    /**
     *
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 关联项目id
     */
    public String getProjectId() {
        return projectId;
    }

    /**
     * 关联项目id
     */
    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    /**
     * 负责人ids:"123,234"
     */
    public String getOwners() {
        return owners;
    }

    /**
     * 负责人ids:"123,234"
     */
    public void setOwners(String owners) {
        this.owners = owners;
    }

    /**
     *
     */
    public Long getBeginTmp() {
        if (beginTmp == null) return 0L;
        else return beginTmp;
    }

    /**
     *
     */
    public void setBeginTmp(Long beginTmp) {
        this.beginTmp = beginTmp;
    }

    /**
     *
     */
    public Long getEnTmp() {
        if (enTmp == null) return 0L;
        else return enTmp;
    }

    /**
     *
     */
    public void setEnTmp(Long enTmp) {
        this.enTmp = enTmp;
    }

    /**
     * 是否已完成 1：true 0：false
     */
    public Integer getState() {
        return state;
    }

    /**
     * 是否已完成 1：true 0：false
     */
    public void setState(Integer state) {
        this.state = state;
    }

    /**
     * 第几步骤 从1开始
     */
    public Integer getStep() {
        return step;
    }

    /**
     * 第几步骤 从1开始
     */
    public void setStep(Integer step) {
        this.step = step;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProjectNode other = (ProjectNode) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getProjectId() == null ? other.getProjectId() == null : this.getProjectId().equals(other.getProjectId()))
                && (this.getOwners() == null ? other.getOwners() == null : this.getOwners().equals(other.getOwners()))
                && (this.getBeginTmp() == null ? other.getBeginTmp() == null : this.getBeginTmp().equals(other.getBeginTmp()))
                && (this.getEnTmp() == null ? other.getEnTmp() == null : this.getEnTmp().equals(other.getEnTmp()))
                && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
                && (this.getStep() == null ? other.getStep() == null : this.getStep().equals(other.getStep()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getProjectId() == null) ? 0 : getProjectId().hashCode());
        result = prime * result + ((getOwners() == null) ? 0 : getOwners().hashCode());
        result = prime * result + ((getBeginTmp() == null) ? 0 : getBeginTmp().hashCode());
        result = prime * result + ((getEnTmp() == null) ? 0 : getEnTmp().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getStep() == null) ? 0 : getStep().hashCode());
        return result;
    }

    @Override
    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        String begT;
        if (getBeginTmp() == 0) begT = "未知";
        else begT = dateFormat.format(beginTmp);
        String endT;
        if (getEnTmp() == 0) endT = "未知";
        else endT = dateFormat.format(beginTmp);
        return "开始时间：" +
                begT +
                "\n" +
                "结束时间：" +
                endT +
                "\n" +
                "负责人：" +
                owners;
    }
}